package com.hainingtong.user.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.hainingtong.user.dto.group.DefaultGroup;
import com.hainingtong.user.dto.group.PhoneCodeGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@ApiModel("手机号验证码登陆")
@EqualsAndHashCode(callSuper = true)
@Data
public class LoginPhoneCodeDto extends LoginUserDto{
    @ApiModelProperty("手机验证码")
    @NotNull(groups = PhoneCodeGroup.class, message = "验证码不能为空")
    @Pattern(groups = PhoneCodeGroup.class, regexp = "\\d{4}", message = "验证码是4位数字")
    private String code;

    // 验证码登陆就忽略密码
    @JsonIgnore
    private String credentials;
}
